package com.zhong.gang.pda.ui.changepass;

import com.zhong.gang.applib.utils.Md5Utils;
import com.zhong.gang.applib.http.BaseDataBean;
import com.zhong.gang.applib.http.callback.DataCallBack;
import com.zhong.gang.pda.api.Api;
import com.zhong.gang.pda.api.HttpUtils;
import com.zhong.gang.pda.db.user.UserUtils;

public class ChangePassPresenter {


    public void changePass(ChangePassAct act,String nowPass,String newPass){
        HttpUtils.post(Api.changePassword,act)
                .addParams("newPassword", Md5Utils.getMd5(newPass))
                .addParams("password",Md5Utils.getMd5(nowPass))
                .addParams("token", UserUtils.getIntent(act).getUser().getToken())
                .build().execute(act,"修改密码",new DataCallBack<BaseDataBean>(act){
            @Override
            public void onResponse(BaseDataBean data) throws Exception {
                super.onResponse(data);
                act.closeActivity();
            }
        });

    }
}
